package nowCoder;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by Ghost on 2015/1/28 0028.
 */
public class DeleteCharsInString {
    public String delete(String src, String targets){
        char[] s = src.toCharArray();
        char[] t = targets.toCharArray();
        List<Character> rst = new LinkedList<Character>();
        int i = 0;
        for(char tmp:t){
            while(s[i]!=tmp){
                rst.add(s[i]);
                i++;
            }
            i++;
        }
        for(;i<s.length;i++)
            rst.add(s[i]);
        StringBuilder sb = new StringBuilder();
        for(char r:rst){
            sb.append(r);
        }
        return sb.toString();
    }
    public static void main(String[] args){
        DeleteCharsInString deleteCharsInString = new DeleteCharsInString();
        System.out.println(deleteCharsInString.delete("abcdeas","ade"));
    }
}
